#pragma once

#include "../GameObject.h"
#include "Exit.h"
#include <vector>

class Character;
typedef std::shared_ptr<Character> CharacterPtr;

class Room;
typedef std::shared_ptr<Room> RoomPtr;

class Room : public GameObject
{
public:
	Room(const std::string &name, const std::string &description);
	virtual ~Room();

	void look() override;
	void update(unsigned int tick) override;

	CharacterPtr add(const CharacterPtr &character);
	void remove(const CharacterPtr &character);
	const std::vector<CharacterPtr> &getCharacters() const { return characters; }

	GameObjectPtr add(const GameObjectPtr &object);
	void remove(const GameObjectPtr &object);
	const std::vector<GameObjectPtr> &getObjects() const { return objects; }
	
	ExitPtr add(ExitPtr exit);
	void remove(const ExitPtr &exit);
	const ExitPtr &getExit(Exit::ExitId direction);
	const std::vector<ExitPtr> &getExits() const { return exits; }

	virtual void enter(const CharacterPtr &character, const Exit::ExitId &from);
	virtual void exit(const CharacterPtr &character, const Exit::ExitId &to);

	virtual void enter(const GameObjectPtr &object, const Exit::ExitId &from);
	virtual void exit(const GameObjectPtr &object, const Exit::ExitId &to);

	enum Setting
	{
		NULL_SETTING = 0,
		SPAWN,
	};
	void add(Setting setting);
	bool has(Setting setting);

protected:
	std::vector<GameObjectPtr> objects;
	std::vector<CharacterPtr> characters;
	std::vector<ExitPtr> exits;
	ExitPtr null_exit;
	std::vector<Setting> settings;
};
